<template>
  <div class="fast">
    <van-nav-bar
      :title="`${huifupinl.reply_count}条回复`">
        <van-icon slot="left" name='cross' @click="$emit('close')">
            
            
        </van-icon>
    </van-nav-bar>
    
    <commentlist :content="huifupinl"></commentlist>
    <van-cell title="所有回复">
      
    </van-cell>
    <comment :scrougID="huifupinl.com_id" type='c'></comment>
    <!-- 发布评论的回复的按钮 -->
    <van-button round size="large" @click="show = true" class="huif">回复</van-button>
    <!-- 发布评论的回复的弹出框 -->
    <van-popup v-model="show"  position="bottom">
      <van-field
        v-model.trim="message"
        rows="2"
        autosize
        
        type="textarea"
        maxlength="50"
        placeholder="请输入留言"
        show-word-limit
      />
      <van-button @click="fabu" :disabled="!message">发布</van-button>
    </van-popup>
    
  </div>
</template>
<script>
import commentlist from './Commentlines'
import {pingl,fabupingl} from '../../../api/article'
import comment from './comments'
// console.log(pingl)
export default {
  name: "huifu",
  props: {
    huifupinl: {
      type: Object,
      required: true,
    },
    userID:{
        type:[String,Object,Number],
        required:true
    }
  },
  components:{
      commentlist,
      comment
  },
  created() {
    console.log(this.huifupinl);
    this.dataUp()
  },
  data(){
      return {
          show:false,
          message:''
      }
  },
  methods: {
    dianzshu() {},
    reply() {},
    async dataUp(){
        const {data} = await pingl({
            type:'c',
            source:this.huifupinl.aut_id.toString(),
            limit:10
        })
        console.log(data)
    },
    async fabu(){
        console.log(this.userID.toString())
        console.log(this.huifupinl.com_id.toString())
        const { data } =  await fabupingl({
            target:this.userID.toString(),
            content:this.message,
            art_id:this.huifupinl.com_id.toString()
        })
        // const {data} = await fabupingl({
        // target:this.ur_id.toString(),
        // content:this.message,
        // art_id:null
        // })
        console.log(data)

    }
   
 
    
  },
};
</script>
<style scoped lang="less">
.fast {
  width: 100%;
  position: absolute;
  top: 0;
  text-align: left;
  /deep/.van-nav-bar .van-ellipsis {
      color: black !important;

  }
  /deep/.van-nav-bar {
      
      .van-nav-bar__left {
          .van-icon  {
              color: #1989fa !important;
          }
      }

  }
  .nr {
    margin-left: 10px;
  }
  .colored {
    // columns: ;
    color: orange;
  }
  .top {
    display: flex;
    justify-content: space-between;
  }
  .huif {
      position: fixed;
      bottom: 10px;
    //   left: 10px;
    //   right: 10px;

  }

}
</style>